<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Rep\SupplierRep;
use Illuminate\Http\Request;

class Supplier extends Controller
{
    //供应商管理
    protected $rep;

    public function __construct(Request $request)
    {
        $this->rep = new SupplierRep();
    }

    /**
     * @param Request $request
     */
    public function getSupplierList(Request $request){
        $params = $request->all();
        $data = $this->rep->getSupplierListRep($params);
        return re(0,$data,'success');
    }

    /**
     *
     * @param Request $request
     */
    public function createSupplier(Request $request){
        $params = $request->all();
        $data = $this->rep->createSupplierRep($params);
        return re($data['code'],$data['data']);
    }

    /**
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function delSupplier(Request $request){
        $params = $request->all();
        $data = $this->rep->delSupplierRep($params);
        return re($data['code']);
    }

}
